﻿using System.ComponentModel.DataAnnotations;
using System.Data.Entity;
using System.Data.Entity.ModelConfiguration.Conventions;

namespace WebBarracoDoSom.Models
{
    public class Usuario
    {
        public int ID { get; set; }

        [Required(ErrorMessage = "Inserir um Nome")]
        public string Nome { get; set; }

        [Required(ErrorMessage = "Inserir Email")]
        [DataType(DataType.EmailAddress)]
        public string Email { get; set; }

        [Required(ErrorMessage = "Inserir Telefone")]
        public string Telefone { get; set; }

        [Required(ErrorMessage = "Inserir CPF")]
        public string CPF { get; set; }

        [Required(ErrorMessage = "Inserir RG")]
        public int RG { get; set; }

        [Required(ErrorMessage = "Inserir Senha")]
        [DataType(DataType.Password)]
        public string Senha { get; set; }

        [Required(ErrorMessage = "Inserir Prioridade")]
        public int Prioridade { get; set; }
    }

    public class UsuarioDBContext : DbContext
    {
        public DbSet<Usuario> Usuarios { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
        }
    }
}